package production_models

import (
	"time"

	"gorm.io/gorm"
)

type BatchMaster struct {
	ID             uint           `gorm:"primarykey;column:id"`
	BatchID        string         `gorm:"column:batch_id;uniqueIndex;size:32;not null"`
	BatchNo        string         `gorm:"column:batch_no;uniqueIndex;size:50;not null" form:"batch_no"` // 添加 form 标签
	CropType       string         `gorm:"column:crop_type;size:50;not null" form:"crop_type"`           // 添加 form 标签
	CreatedAt      time.Time      `gorm:"column:created_at;not null"`
	UpdatedAt      time.Time      `gorm:"column:updated_at;not null"`
	DeletedAt      gorm.DeletedAt `gorm:"column:deleted_at;index"`
	CreatedBy      string         `gorm:"column:created_by;size:50;not null" form:"created_by"` // 添加 form 标签
	Status         int8           `gorm:"column:status;default:0"`
	ExpirationDate *time.Time     `gorm:"column:expiration_date"`
}

func (BatchMaster) TableName() string {
	return "batch_master" // 确保这里的表名与SQL文件中的表名完全一致
}
